<%@ include file="header.jsp" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="Model.Matchmaking.Match" %>
<hr class="noscreen" />
<%
	if(session.getAttribute("loggedIn") != Boolean.TRUE) {
	%>
<meta HTTP-EQUIV="REFRESH" content="0; url=login.jsp">
<%} else {%>
    <!-- Three columns -->
    <div class="content box">
    
        <div class="content-in box">


		<table>
                <tr>
                    <th></th>
                    <th>User</th>
                    <th>Compatibility Score</th>
                    <th>Send Message</th>
                    <th>Set up date</th>
                </tr>
                	
                	<%
                	ArrayList<Match> results = Match.getMatches(userID);
                	for(int i=0;i<results.size() && i <results.size(); i++) {
						Match result = results.get(i);
						int resultID = result.getUserID();
					%>
				         <tr <% if (i%2==0){%>class="odd"<%} %>>
				             <td><img src="userprofiles/<%=resultID %>.jpg" width="50" height="50"></td>
				             <td align="center"><a href="profile.jsp?id=<%=resultID%>"><%=User.getName(resultID) %></a></td>
		                    <td align="center"><%=result.getScore() %></td>
		                    <td align="center">
		                    <form name="input" action="createMessage.jsp" method="get">
								<input type="hidden" id="toUser" name="toUser" value=<%=resultID%> />
								<input class="input-submit-small" type="submit" value="Message" />
							</form> 
							</td>
		                    <td align="center"><a href="./googleMapDate.jsp?id=<%=resultID%>"><img src="./images/heart.jpg" height="32" width="32"></a></td>
				         </tr>
					<%} %>
			</table>

            <h2><!-- /col50 -->            </h2>
            <div class="fix"></div>

        </div> <!-- /content-in -->
        
        <div class="content-bottom"></div>

    </div> <!-- /content -->
<%} %>
<%@ include file="footer.jsp" %>